#include "udpserver.hpp"
int main(int argc, char *argv[])
{
    string serverip = argv[1];
    uint16_t serverport = stoi(argv[2]);
    int _socket = 0;
    _socket = socket(_socket, AF_INET, 0);
    struct sockaddr_in server;
    memset(&server, 0, sizeof(server));
    server.sin_family = AF_INET;
    server.sin_port = htons(serverport);
    server.sin_addr.s_addr = inet_addr(serverip.c_str());


    while (true)
    {
        string line;
        getline(cin,line);
        sendto(_socket, line.c_str(), sizeof(line), 0,(struct sockaddr *)&server,sizeof(server));
        struct sockaddr_in temp;
        char buffer[1024];
        buffer[0]=0;
        socklen_t len =sizeof(temp);

        int n =recvfrom(_socket,buffer,sizeof(buffer),0,(sockaddr*)&temp,&len);
        buffer[n]=0;
    
    }
}
